package special_tree;

import compiler.CompilerException;

import code.CodeList;
import lexer.Token;
import tree.ClassScope;
import tree.DataType;
import tree.IdentifierScope;
import tree.MethodScope;
import tree.MyTree;
import tree.NamingException;
import tree.Tree;
import tree.Type;
import tree.TypingException;

public class AssignTree extends MyTree {

	public AssignTree(Token token, Tree... operands) {
		super(token, operands);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tree.MyTree#analyzeNames(tree.IdentifierScope, tree.MethodScope,
	 * tree.ClassScope)
	 */
	@Override
	@Deprecated
	public void analyzeNames(IdentifierScope identScope,
			MethodScope methodScope, ClassScope classScope)
			throws NamingException {
		this.getOperand(1).analyzeNames(identScope, methodScope, classScope);
		this.getOperand(0).analyzeNames(identScope, methodScope, classScope);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tree.MyTree#computeType()
	 */
	@Override
	@Deprecated
	public Type computeType() throws TypingException {
		this.expectSameType(this.getOperand(0), this.getOperand(1));
		return new Type(DataType.VOID, "");
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see tree.MyTree#generateCode(code.CodeList)
	 */
	@Override
	@Deprecated
	public void generateCode(CodeList code) throws CompilerException {
		getOperand(1).generateCode(code);
		getOperand(0).generateCode(code);
	}

}
